var express = require('express');
const {selectMenu, deleteMenu, modifyMenu, addMenu} = require("../services/menu");
const {selectMenuListToShow} = require("../services/menu/select");
const router = express.Router();

router.get('/menu', async (req, res) => { //查询菜单
    await selectMenu(res, req.user.role_id)
})
router.get('/menu/show', async (req, res) => {
    await selectMenuListToShow(res)
})
router.delete('/menu', (req, res) => {//删除菜单
    deleteMenu(req.query, res)
})

router.put('/menu', (req, res) => { //修改菜单
    console.log('shAre')
    modifyMenu(req.body, res)
})

router.post('/menu', (req, res) => { //新增菜单
    addMenu(req.body, res)
})
module.exports = router
